import React, { Component } from "react";

export default class RefDemo extends Component {
  myinput = React.createRef();

  render() {
    return (
      <div>
        <input type="text" ref={this.myinput} />
        <button
          onClick={() => {
            console.log("点击事件", this.myinput.current.value);
          }}
        >
          1
        </button>
      </div>
    );
  }
}
